Form talk:Favorites
Debugging partial forms Some key learnings * |hidden is supposed to preserve prior values of a property but it only preserves prior values of a named parameter in the template call. This is fine if the only way that property values get changed is via a template call but it breaks down when code within the template modifies or combines named parameters to assign values to properties. * |default=current user is a misnomer. It does not substitute the name of the user currently interfacing with the form to edit the page. It substitutes the name of the user who first created the page. As such it is useful only at the time of page creation and not for subsequent editing of semantic data on the page. It's behavior is better described as |default=page creator * |default=now does not insert the current date into the form. Presumably this only has a useful function at the time of creating a new page. * when |values from category=Usernames is used to enumerate permitted values for a field there is no need to use |autocomplete on namespace=User or |autocomplete on category=Usernames. This is because the default input type for enumerated string values is the dropdown'''and this input box natively enforces autocompletion on the enumerated values. * Be careful when using |input type=listbox since it allows the input value to be either (i) blank or (ii) a single sting or (iii) a comma-delimited list of strings. If the template is expecting a single string then do not use '''listbox. * May have been fixed with SF v1.7 however with SF v1.5.1 |default=|input type=radiobutton will cause a radio button labeled "none" to appear in the form. * } is useful when you don't want the user tampering with other markup code on a page. There seems to be a bug which manifests after a partial form is first used on a page. The markup for the entire page is displayed in this free text block even though the advertised behavior is that only markup from above and below the target template call be visible. * It does not seem to be possible to preload or specify a default string for the edit summary field. Neither } nor } behave intuitively. * The example below demonstrates the relabeling of the "Save page" button to something that better matches the intent of the form. In this case } the Confirm label is more intuitive. Also note that other standard input buttons and links may be hidden of that streamlines the interface and lends focus to the form. (Too many choices/decisions can confuse some people.) } } } Verify username: } } } } } } Workaround for preload of current user name A piece of javascript intended to preload certain form fields with the name of the current user is still being debuged. The template associated with the form must use the named parameter Thisuser for the selector in this script to find the correct input field(s). It is working for input types: (i) text and (ii) dropdown but not for (iii) radiobutton and probably not for (iv) checklist. function preloadThisUserName() { $("#bodyContent form.createbox") /* narrows the search */ .find("input[name$='Thisuser']") /* affects _any_ template with a parameter/field named: Thisuser */ .val(wgUserName); /* Checks, or selects, all the radio buttons, checkboxes, and select options that match the user name. */ $("#bodyContent form.createbox") .find("select[name$='Thisuser']") .val(wgUserName); /* Checks, or selects, all the radio buttons, checkboxes, and select options that match the user name. */ } najevi 15:41, 20 July 2009 (UTC)